package com.servlet;

import java.util.List;
import java.util.Map;

import hyl.core.MyFun;
import hyl.core.db.MyDB;

public class M2 {
	public static int ROLE_管理员 = 1;
	public static int ROLE_政府 = 2;
	public static int ROLE_校长 = 4;
	public static int ROLE_教师 = 8;
	public static int ROLE_学生 = 16;

	public static int DEVICE_手环 = 1;
	public static int DEVICE_信标 = 2;
	public static int DEVICE_摄像 = 3;

	/**
	 * 
	 * @用于判断权限
	 */
	public static String getRole(int 权限id) {
		List<Map<String, Object>> list = M.LRole;
		String 可用权限 = "";
		for (Map<String, Object> b : list) {
			int roleid = MyFun.obj2Int(b.get("id"));
			if ((权限id & roleid) == roleid) {
				可用权限 += b.get("manage");
			}
		}
		return 可用权限;
	}

	// 会员权限
	public static List<Map<String, Object>> getRoles() {
		MyDB db = My.getDB1();
		String sql = "select id,manage from sys_rolemanage a";
		List<Map<String, Object>> list = db.queryList(sql, null);
		return list;
	}

}
